<script setup lang="ts">

import { bindmobile } from '@/services/user'
import { useRoute, useRouter } from 'vue-router'
import { useUserStore } from '@/stores'
const store = useUserStore()
import { ref } from 'vue'
// import { useRoute, useRouter } from 'vue-router'
// const store = useUserStore()
const mobile = ref()
const router = useRouter()
const route = useRoute()

const onSubmit = async () => {
    let uid = route.query.uid
    alert(route.query.uid)
    const res = await  bindmobile(mobile.value,uid)

    console.log(res.data)
    // localStorage.setItem('token',res.data.token)
    store.setUser(res.data)
//   showSuccessToast('登录成功')
  router.replace('/home')
}

</script>

<template>
  <div class="login-page">
   
    <!-- 表单 -->
    <van-form autocomplete="off" @submit="onSubmit" ref="form">
      <van-field
        name="mobile"
        v-model="mobile"
        placeholder="请输入手机号"
        type="tel"
      ></van-field>
     
    
      <div class="cp-cell">
        <van-button native-type="submit" block round type="primary">
          绑定
        </van-button>
      </div>
      
    </van-form>
   
  </div>
</template>

<style lang="scss" scoped>
@import '@/styles/login.scss';
</style>
